bitkeeper revision 1.1159.1.110 (412ef3f1vl_4cVn-pCxQHFvK5hcIZQ)
authormjw@wray-m-3.hpl.hp.com <mjw@wray-m-3.hpl.hp.com>
Fri, 27 Aug 2004 08:42:25 +0000 (08:42 +0000)
committermjw@wray-m-3.hpl.hp.com <mjw@wray-m-3.hpl.hp.com>
Fri, 27 Aug 2004 08:42:25 +0000 (08:42 +0000)
Raise an error if a device cannot be found.
This prevents constructing a block device that will then
cause errors because its vdev is not set.

tools/python/xen/xend/XendDomainInfo.py

index dabcb68e7ebee1ecf5604be21813d17b7196073e..673153dd66d990e77001274f76b27b2c5f1e9f13 100644 (file)
@@ -132,8 +132,11 @@ def lookup_raw_partn(name):
 
 def lookup_disk_uname(uname):
     """Lookup a list of segments for a physical device.
-    uname [string]:  name of the device in the format \'phy:dev\' for a physical device
-    returns [list of dicts]: list of extents that make up the named device
+    
+    @param uname: name of the device in the format \'phy:dev\' for a physical device
+    @type  uname: string
+    @return: list of extents that make up the named device
+    @rtype: [dict]
     """
     ( type, d_name ) = string.split( uname, ':' )
 
@@ -159,14 +162,17 @@ def make_disk(vm, config, uname, dev, mode, recreate=0):
     if len(segments) > 1:
         raise VmError("vbd: Multi-segment vdisk: uname=%s" % uname)
     segment = segments[0]
+    # todo: The 'dev' should be looked up in the context of the domain.
     vdev = blkdev_name_to_number(dev)
+    if not vdev:
+        raise VmError("vbd: Device not found: uname=%s dev=%s" % (uname, dev))
     ctrl = xend.blkif_create(vm.dom, recreate=recreate)
     return ctrl.attachDevice(config, vdev, mode, segment, recreate=recreate)
         
 def vif_up(iplist):
     """send an unsolicited ARP reply for all non link-local IP addresses.
 
-    iplist IP addresses
+    @param iplist: IP addresses
     """
 
     IP_NONLOCAL_BIND = '/proc/sys/net/ipv4/ip_nonlocal_bind'